/**
 * 检测数据类型
 */
type typeFunction = {
  [key: string]: any;
};

export function dataTypes() {
  const type_fun: typeFunction = {};
  const types: string[] = [
    "Number",
    "String",
    "Boolean",
    "Array",
    "Function",
    "Null",
    "Undefained",
    "Set",
    "Map",
    "Object",
  ];
  types.forEach((item) => {
    const fun = `is${item}`;
    type_fun[fun] = (value: string) =>
      Object.prototype.toString.call(value) === `[object ${item}]`;
  });
  return type_fun;
}
